import statsmodels.api as sm
from numpy import asarray,log, log10
# 拟合线性回归
y1 = [1,0.96872285,0.939617724,0.886185925]
y = [log10(p) for p in y1]
print(y)

#y=[0,-0.013800456,-0.0270488,-0.052475152]
y_price_series = asarray(y, dtype="float")
x = sm.add_constant(asarray([0, 1, 4, 8], dtype="float"))
result = sm.OLS(y_price_series, x).fit()
print(result.params)
ols = result.params[1]
print(ols)

r = pow(10, ols)
print(r)
